<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>project.jspe</title>
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
	<link rel="stylesheet" type="text/css" href="css/style.css" />
  	<link rel="stylesheet" href="css/jquery.atwho.css" type="text/css"></link>
  </head>

  <body>
 	 <jsp:include page="include/top.jsp"></jsp:include>
	<div class="container">
		<div class="row">
				<jsp:include page="include/left.jsp"></jsp:include>
				<div class="span6">
					<ul class="breadcrumb" style="margin-bottom:0px; border-radius:3px 3px; ">
						<li class="active">						
							<i class="icon-th"></i>你在想些什么？
						</li>
					</ul>	
					<div class="wall">
						<form action="toMessage.jspx" method="post" calss="mesForm">
							<textarea name="message" id="mes" style="margin-top:0px;height:50px; width:420px" placeholder="说点什么吧" rows="5"></textarea><br/>
							<button type="button" class="fabu btn btn-primary" id="publish">发布</button>
						</form>
					</div>
					<ul class="breadcrumb" style="margin-top:20px; margin-bottom:0px; border-radius:3px 3px;">
						<li class="active">
							<i class="icon-th"></i>好友动态
						</li>
					</ul>
					<div class="wall">
						<c:forEach items= "${mesList}" var="mes">
						 	<div style="word-wrap:break-word"><a href="#">${mes.username}</a>:<p >${mes.mescontent}</p></div>
						 	<div style="display:none" id="commentDiv${mes.mesid}">
							 	<form action="messageCommentServlet.jspx?mesId=${mes.mesid}" method="post" name="commentForm" id="commentForm${mes.mesid}">
							 		<textarea name="taskComment" id="taskComment${mes.mesid}" style="margin-top:0px;height:50px; width:420px"rows="5"></textarea>
							 	</form>
						 	</div>
						 	<div style="float:right">${mes.createtime }&nbsp;&nbsp;<a href="javascript:;" class="comment" id="comment${mes.mesid}">评论</a>&nbsp;&nbsp;<a href="#" id="trans">转发</a></div><br/>
								<c:forEach items="${mesComList}" var="mesCom">
									<c:if test="${mes.mesid == mesCom.mesid }">
										<div>&nbsp;&nbsp;&nbsp;&nbsp;<a> ${mesCom.username}</a>:${mesCom.comment }&nbsp;&nbsp;&nbsp;&nbsp;${mesCom.commenttime }</div>
									</c:if>
								</c:forEach>
							<hr/>
						</c:forEach>
					</div>			
				</div>
				<div class="span3">
					<div class="box">
						<div class="head">我的任务</div>
						<ul>
							<c:forEach	items="${taskList}" var="task">
								<li><a href="toTask.jspx?taskId=${task.goal_id}">${task.task_name}</a></li>
							</c:forEach>
						</ul>
					</div>
				</div>
			</div>
	</div>

	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript">
		$(function(){
			<!-- message评论 -->
			<c:forEach items="${mesList}" var="mes">
				$("#comment${mes.mesid}").click(function(){
					$("#commentDiv${mes.mesid}").show();
					$("#taskComment").focus();
					$("#comment${mes.mesid}").click(function(){
						var taskComment = $("#taskComment${mes.mesid}").val(); 
						if(taskComment){
							$("#commentForm${mes.mesid}").submit(); 
						}else{
							$("#commentDiv${mes.mesid}").hide();
						}
					});
				});
			</c:forEach>
		
		
		});
	</script>
  </body>
</html>
